package com.recruit.wechat.controller;


import com.recruit.wechat.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import com.recruit.wechat.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import com.recruit.wechat.bean.WechatSkills;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 肖守凯
 * @since 2020-08-24
 */
@Controller
@RequestMapping("/WeChatUser/wechatSkills")
public class WechatSkillsController extends BaseController{
     /** 主页面 */
    @RequestMapping("admin/main.html")
    public String main(){
       return  "Wechatskills/WechatskillsMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "admin/addWechatSkillsHtml")
    public String addWechatSkillsHtml( ){
             return "Wechatskills/WechatskillsAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/editWechatSkillsHtml")
    public String editWechatSkillsHtml(Integer id ,Model model ){
           model.addAttribute("wechatSkills",wechatSkillsService.selectWechatSkillsByIdWechatSkills(id));
             return "Wechatskills/WechatskillsEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/showWechatSkillsHtml")
    public String showWechatSkillsHtml(Integer id ,Model model ){
           model.addAttribute("wechatSkills",wechatSkillsService.selectWechatSkillsByIdWechatSkills(id));
             return "Wechatskills/WechatskillsShow";
    }


    /** 分页查询WechatSkills
     * @param page  页码
     * @param limit  查几条
     * @param wechatSkills  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "admin/findWechatSkillsByPage")
    @ResponseBody
    public ResultPage findWechatSkillsByPage(Integer page, Integer limit,WechatSkills wechatSkills){
             return wechatSkillsService.findWechatSkillsByPage(page,limit,wechatSkills);
    }

    /** 添加WechatSkills
     * @param wechatSkills  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/addWechatSkills")
    @ResponseBody
    public ApiResultModel saveWechatSkills(WechatSkills wechatSkills  ){
             return wechatSkillsService.addWechatSkills(wechatSkills);
    }

    /** 编辑WechatSkills
     * @param wechatSkills  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/editWechatSkills")
    @ResponseBody
    public ApiResultModel editWechatSkills(WechatSkills wechatSkills  ){
             return wechatSkillsService.editWechatSkills(wechatSkills);
    }



    /** 删除一条WechatSkills
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/delWechatSkills")
    @ResponseBody
    public ApiResultModel delWechatSkills( Integer id  ){
             return wechatSkillsService.delWechatSkills(id);
    }


}
